package com.woniu.service.bean;

import com.woniu.util.ApplicationContextHolder;
import lombok.Data;

import java.math.BigDecimal;

@Data
public class GoldFundSell {
    private Integer id;
    private String codeId;
    private BigDecimal sellSale;
    private String schedule;
    private Integer orderId;
    private String sellTime;
    private Integer sId;
    private Integer userId;
    private BigDecimal dealPrice;
    private String productType;
    private GoldFundSellHandler handler;

    public GoldFundSell(){
        this.handler = ApplicationContextHolder.getApplicationContext().getBean(GoldFundSellHandler.class);
    }

    public GoldFundSell(Integer id, String codeId, BigDecimal sellSale, String schedule, Integer orderId, String sellTime, Integer sId, Integer userId, BigDecimal dealPrice, String productType) {
        this();
        this.id = id;
        this.codeId = codeId;
        this.sellSale = sellSale;
        this.schedule = schedule;
        this.orderId = orderId;
        this.sellTime = sellTime;
        this.sId = sId;
        this.userId = userId;
        this.dealPrice = dealPrice;
        this.productType = productType;
    }

    public void execute() {
        handler.action(this);
    }
}
